package com.hfmall.controller;


import com.hfmall.entity.HfComments;
import com.hfmall.entity.HfUser;
import com.hfmall.entity.ResponseCode;
import com.hfmall.service.IHfCommentsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liclo
 * @since 2021-08-12
 */
@CrossOrigin(value = "http://localhost:8081", allowCredentials = "true")
@RestController
@RequestMapping("comments")
public class HfCommentsController {
    @Resource
    private IHfCommentsService iHfCommentsService;
    @GetMapping("list")
    public ResponseCode<List<HfComments>> list(){
        return new ResponseCode<List<HfComments>>(iHfCommentsService.list());
    }
    @ResponseBody
    @PostMapping("updates")
    public ResponseCode update(@RequestBody HfComments comments){
        iHfCommentsService.updateByID(comments);
        return ResponseCode.SUCCESS;
    }
}
